package com.zl.pro.controller;

import java.util.List;


import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.zl.pro.pojo.Collect;
import com.zl.pro.pojo.CommonResult;
import com.zl.pro.service.FundDetailsService;

@RestController
public class CollectController {

	@Resource
	private FundDetailsService fundDetailsService;
	
	
	//添加基金到收藏夹
	@RequestMapping(value="/collect/insertone",method=RequestMethod.GET)
	public CommonResult<Collect> insertOne(HttpServletRequest request,@RequestParam(value="funddetailsid") Long funddetailsid){
		   CommonResult<Collect> result = new CommonResult<Collect>();
		
		   result.setResultDatas(fundDetailsService.insertOne(request, funddetailsid));
		   return result;
	}
	
	//通过用户id查询用户的收藏基金
		@RequestMapping(value="/collect/findall",method=RequestMethod.GET)
		public CommonResult<Collect> findAll(HttpServletRequest request){
//			List<Collect>
			CommonResult<Collect> result = new CommonResult<Collect>();
			result.setResultDatas(fundDetailsService.findAll(request));
			return result;
		}
	
	
}
